﻿define([
], function () {

    var controller = BackboneMVC.Controller.extend({
        name: 'companyManager',
        show: function ($el) {
            require([(__currentSession.userLogin.toLowerCase() == 'super') ? 'views/crud/company/super/companyManager' : 'views/crud/company/common/companyManager'], function (View) {
                var view = new View();
                view.setElement($el);
                view.render();
            });
        },
        showEdit: function ($el, id) {
            require([(__currentSession.userLogin.toLowerCase() == 'super') ? 'views/crud/company/super/companyEdit' : 'views/crud/company/common/companyEdit'], function (View) {
                var view = new View();
                view.constructor({ companyId: id });
                view.setElement($el);
                view.render();
            });
        },
        showEditPref: function ($el, id) {
            require([(__currentSession.userLogin.toLowerCase() == 'super') ? 'views/crud/company/super/companyPrefEdit' : 'views/crud/company/common/companyPrefEdit'], function (View) {
                var view = new View({ companyId: id });
                view.setElement($el);
                view.render();
            });
        },
        addData: function ($el) {
            require([(__currentSession.userLogin.toLowerCase() == 'super') ? 'views/crud/company/super/companyCreate' : 'views/crud/company/common/companyCreate'], function (View) {
                var view = new View();
                view.setElement($el);
                view.render();
            });
        }
    });
    return controller;
});